import unittest

import config
from common.HTMLTestRunner_PY3 import HTMLTestRunner
from scripts.test01_regLogin import TestRegLogin
from scripts.test02_openAccount import TestOpenAccount
from scripts.test03_recharge import TestRecharge
from scripts.test04_tender import TestTender

# 实例化测试套件
suite = unittest.TestSuite()

# 添加测试类
suite.addTest(unittest.makeSuite(TestRegLogin))
suite.addTest(unittest.makeSuite(TestOpenAccount))
suite.addTest(unittest.makeSuite(TestRecharge))
suite.addTest(unittest.makeSuite(TestTender))

# 定义测试报告存放的目录
report_path = config.BASE_PATH + "/report/report.html"

# 将测试结果写入到测试报告中
with open(report_path, mode="wb") as f:
    # 实例化HTMLTestRunner类
    runner = HTMLTestRunner(f)
    # 运行测试套件
    runner.run(suite)



# # 实例化TextTestRunner类
# runner = unittest.TextTestRunner()
#
# # 运行测试套件
# runner.run(suite)
